package com.sc.auction.common.interceptor;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class JWTInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        //如下代码如果不设置，header中将取不出token信息
//        if(request.getMethod().equals("OPTIONS")){
//            response.setStatus(HttpServletResponse.SC_OK);
//            return true;
//        }
//        //获取请求中的令牌
//        String token = request.getHeader("token");
//        System.out.println("*****************************************");
//        System.out.println("拦截的路径为:"+request.getRequestURL());
//        System.out.println("拦截的路径为:"+request.getRequestURI());
//        System.out.println("拦截器中获取令牌:"+token);
//        System.out.println("*****************************************");
//        if(token==null){
//            return false;
//        }
        return true;
    }
}
